import {onBeforeUnmount, onMounted, reactive} from 'vue'
export default function t() {
    //实现打点的数据
    let point = reactive({
        x:0,
        y:0
    })

    //实现打点的方法
    function savePoint(event){
            point.x = event.pageX
            point.y = event.pageY
            console.log(event.pageX,event.pageY)
    }
    
    //是想打点的钩子
    onMounted(()=>{
        window.addEventListener('click',savePoint)
    })

    onBeforeUnmount(()=>{
        window.removeEventListener('click',savePoint)
    })

    return point
}

